lib/sysroot: Call `chmod` on overlay dirs when unlocking
authorJonathan Lebon <jonathan@jlebon.com>
Tue, 23 Apr 2019 20:03:48 +0000 (16:03 -0400)
committerAtomic Bot <atomic-devel@projectatomic.io>
Wed, 24 Apr 2019 13:48:14 +0000 (13:48 +0000)
commit794f75ca61badfe34f4ba1f8eb50a574d83d3c58
tree03940293a72c5f4671ffe52498ca7865e3646030
parent498a8bd404db86b6b46662ccde5a51344b212187
lib/sysroot: Call `chmod` on overlay dirs when unlocking

Otherwise, we'll be subject to whatever `umask` is currently. Normally,
processes should respect `umask` when creating files and directories,
but specifically for `ostree admin unlock` (or `rpm-ostree usroverlay`),
this poses a problem since e.g. a `/usr` with mode 0700 will break any
daemon that doesn't run as root and needs to read files under `/usr`,
such as polkitd.

This patch just does a `chmod()` after the `mkdir()`. An alternative
would be to do `umask(0000)` after forking into the child process
that'll call `mount()`, but that'd require also moving the `mkdir()`
calls into there, making for a more intrusive patch.

Closes: #1843
Approved by: cgwalters
src/libostree/ostree-sysroot.c